<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        class Father {
            // 每个龙子都会飞
            fly() {
                console.log('我要飞得更高');
            }
        }
        class Son extends Father { // extends Father 可以实现子类继承父类（基类）
            constructor(n, hobby) {
                super(); // 先调用super才能正常使用this
                this.name = n;
                this.hobby = hobby;
            }
        }
        // 龙生九子
        let son1 = new Son('貔貅', 'money')
        let son2 = new Son('狴犴', '抓坏蛋')
        console.log(son1.fly());
        console.log(son2);
    </script>
</body>
</html>